<?php
namespace Common\Model;

/**
 * 房型初始化表
 * @modify zhangzhen 2016-12-23 创建
 */

Class HourRoomInitModel extends \Common\Model\BaseModel
{
    protected $trueTableName = 'tb_hour_room_init';
    protected function _before_insert(&$data, $options) {}
    protected function _before_update(&$data, $options) {}
    /**
     * 房型初始化
	 * @modify zhangzhen 2017-03-27    创建  
     * @param  integer   $hotelId      客栈Id
	 * @param  integer   $checkinTime  checkin时间
     * @param  integer   $checkoutTime checkout时间
     * @return boolean 添加结果
     */
    public function addInfo($hotelId, $checkinTime, $checkoutTime) {
        $data = [
			'hotelentity_id' => $hotelId,
            'checkintime' => $checkinTime,
            'checkouttime' => $checkoutTime,
        ];
        $id = $this->add($data);
        return $id === false ? false : $id;
    }
    public function getInfo($hotelId) {
        $options = [
            'hotelentity_id' => $hotelId,
        ];
        $result = $this->where($options)->find();
        return empty($result) ? [] : $result;
    }
}
